//
//  MyWalletDetailController.m
//  OnionHome
//
//  Created by fengjie on 2019/9/14.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "MyWalletDetailController.h"

@interface MyWalletDetailController ()

@end

@implementation MyWalletDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = UIColorFromRGB(0xF5F7F5);
    self.title = @"明细";
    [self createUI];
}
-(void)createUI{
    UIImageView * topImage = UIImageView.new;
    topImage.image = IMAGE_NAMED(@"money");
    topImage.layer.cornerRadius = 38;
    
    UILabel * topLabel = UILabel.new;
    topLabel.textColor = UIColorFromRGB(0x273323);
    topLabel.font = PingFangSC_Medium(22);
    topLabel.text = @"充值+400";
    
    UIView * oneView = [self createViewLeftName:@"当前状态" RightName:@"充值完成"];
    UIView * twoView = [self createViewLeftName:@"充值时间" RightName:@"2019-05-26 16:21:11"];
    UIView * thereView = [self createViewLeftName:@"支付方式" RightName:@"微信"];
    UIView * fourView = [self createViewLeftName:@"交易单号" RightName:@"2344654565867879"];

    
    [self.view addSubview:topImage];
    [self.view addSubview:topLabel];
    [self.view addSubview:oneView];
    [self.view addSubview:twoView];
    [self.view addSubview:thereView];
    [self.view addSubview:fourView];

    [topImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(52);
        make.width.height.mas_equalTo(76);
    }];
    [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(topImage.mas_bottom).offset(20);
    }];
    
    [oneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(topLabel.mas_bottom).offset(20);
    }];
    [twoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(oneView.mas_bottom).offset(0);
    }];
    [thereView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(twoView.mas_bottom).offset(0);
    }];
    [fourView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(thereView.mas_bottom).offset(0);
    }];

}
-(UIView *)createViewLeftName:(NSString *)leftName RightName:(NSString *)rightName{
    UIView * view = UIView.new;
    view.backgroundColor = UIColor.whiteColor;
    
    UILabel * leftLabel = UILabel.new;
    leftLabel.textColor = UIColorFromRGB(0x959E97);
    leftLabel.font = SYSTEMFONT(16);
    leftLabel.text =leftName;
    
    UILabel * rightLabel = UILabel.new;
    rightLabel.textColor = UIColorFromRGB(0x273323);
    rightLabel.font = SYSTEMFONT(16);
    rightLabel.text = rightName;
    
    
    [view addSubview:leftLabel];
    [view addSubview:rightLabel];
    
    [leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(16);
        make.bottom.mas_equalTo(-16);
    }];
    
    [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(leftLabel.mas_right).offset(20);
        make.centerY.mas_equalTo(leftLabel);
    }];
    
    return view;
}

@end
